<?php
/*
Bitsand - a web-based booking system for LRP events
Copyright (C) 2006 - 2009 The Bitsand Project (http://bitsand.googlecode.com/)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

include ('inc/inc_head_db.php');

function paypalButton($itemLabel, $itemAmount, $meal, $bunk) {
	global $PLAYER_ID;
	if ($itemAmount != '')
	{
		echo "<td class = 'mid'>\n";
		if ($itemAmount != '0.00') {
			echo "<form target='paypal' action='https://www.paypal.com/cgi-bin/webscr' method='post'>\n";
			echo "<input type='hidden' name='cmd' value='_xclick'>\n";
			echo "<input type='hidden' name='business' value='" . PAYPAL_EMAIL . "'>\n";
			echo "<input type='hidden' name='item_name' value='" . $itemLabel .
				" (" . PID_PREFIX . sprintf ('%03s', $PLAYER_ID) . ")'>\n";
			echo "<input type='hidden' name='item_number' value='$PLAYER_ID'>\n";
			echo "<input type='hidden' name='custom' value='00'>\n";
			echo "<input type='hidden' name='cbt' value='Return to " . SYSTEM_NAME . "'>\n";
			echo "<input type='hidden' name='currency_code' value='GBP'>\n";
			echo "<input type='hidden' name='amount' value='" . $itemAmount . "'>\n";
			echo "<input type='hidden' name='no_shipping' value='1'>\n";
			echo "<input type = 'hidden' name = 'return' value = '" . SYSTEM_URL . "start.php?action=paypal_paid&id=$PLAYER_ID&meal=$meal&bunk=$bunk'>\n";
			echo "<input type = 'hidden' name = 'cancel_return' value = '" . SYSTEM_URL . "start.php?warn=PayPal payment cancelled'>\n";
			echo "<input type = 'hidden' name = 'notify_url' value = '" . SYSTEM_URL . "paypal_receipt.php'>\n";
			echo "<input type='image' src='http://images.paypal.com/images/x-click-but01.gif' name='submit' alt='Make payments with PayPal - fast, free and secure!'>\n";
			echo "</form>\n";
		}
		else {
			// code for free booking is dependent on password salt, player ID, and date
			$free = sha1 (PW_SALT . $PLAYER_ID . date ('Y-m-d'));
			echo "<a href = 'start.php?pay=$free&meal=".$meal."&bunk=".$bunk."'>Finalise booking</a>";
		}
		echo "</td>\n";
	}
}

$db_prefix = DB_PREFIX;

//Get number of players, monsters, staff booked
$sql = "SELECT COUNT(*) AS i_count FROM {$db_prefix}bookings, {$db_prefix}players " .
	"WHERE plBookAs LIKE 'Player' AND plPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";
$temp = ba_db_query ($link, $sql);
$ap = ba_db_fetch_assoc ($temp);
$iPlayers = $ap ['i_count'];
$sql = "SELECT COUNT(*) AS i_count FROM {$db_prefix}bookings, {$db_prefix}players " .
	"WHERE plBookAs LIKE 'Monster' AND plPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";
$temp = ba_db_query ($link, $sql);
$am = ba_db_fetch_assoc ($temp);
$iMonsters = $am ['i_count'];
$sql = "SELECT COUNT(*) AS i_count FROM {$db_prefix}bookings, {$db_prefix}players " .
	"WHERE plBookAs LIKE 'Staff' AND plPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";
$temp = ba_db_query ($link, $sql);
$as = ba_db_fetch_assoc ($temp);
$iStaff = $as ['i_count'];
//Total number of bookings
$iTotalBookings = $iPlayers + $iMonsters + $iStaff;

//Get number of bunks booked
$sql = "SELECT COUNT(*) AS i_count FROM {$db_prefix}bookings, {$db_prefix}players " .
	"WHERE plBookAs LIKE 'Player' AND plBunkAssigned = 1 AND " .
	"plPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";
$temp = ba_db_query ($link, $sql);
$ap = ba_db_fetch_assoc ($temp);
$iPlayerBunks = $ap ['i_count'];
$sql = "SELECT COUNT(*) AS i_count FROM {$db_prefix}bookings, {$db_prefix}players " .
	"WHERE plBookAs LIKE 'Staff' AND plBunkAssigned = 1 AND " .
	"plPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";
$temp = ba_db_query ($link, $sql);
$as = ba_db_fetch_assoc ($temp);
$iStaffBunks = $as ['i_count'];
$sql = "SELECT COUNT(*) AS i_count FROM {$db_prefix}bookings, {$db_prefix}players " .
	"WHERE plBookAs LIKE 'Monster' AND plBunkAssigned = 1 AND " .
	"plPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '' AND bkDatePaymentConfirmed <> '0000-00-00'";
$temp = ba_db_query ($link, $sql);
$am = ba_db_fetch_assoc ($temp);
$iMonsterBunks = $am ['i_count'];
//Total bunks booked
$iTotalBunks = $iPlayerBunks + $iMonsterBunks + $iStaffBunks;

//If user has paid, mark as "payment received" and redirect to this page without query string
//Redirecting to this page without query string will mean that "you are fully booked" message is displayed

// code for free booking is dependent on password salt, player ID, and date
$free = sha1 (PW_SALT . $PLAYER_ID . date ('Y-m-d'));
if ($_GET ['pay'] == $free && CheckReferrer ('start.php') || $_GET ['action'] == "paypal_paid") {
	//Run UPDATE query to set date payment received
	$sDate = date ('Y-m-d');
	$sql = "UPDATE {$db_prefix}bookings SET bkDatePaymentConfirmed = '$sDate'";
	if ($_GET ['meal'] == 'yes')
		$sql .= ", bkMealTicket = 1";
	if ($_GET ['action'] == "paypal_paid")
		$sql .= " WHERE bkPlayerID = {$_GET ['id']}";
	else
		$sql .= " WHERE bkPlayerID = $PLAYER_ID";
	ba_db_query ($link, $sql);
	//Set bunk requested & assigned if that option was taken
	if ($_GET ['bunk'] == 'yes') {
		$sql = "UPDATE {$db_prefix}players SET plBunkRequested = 1, plBunkAssigned = 1 WHERE plPlayerID = $PLAYER_ID";
		ba_db_query ($link, $sql);
	}

	//Send e-mail
	$sql_select = "SELECT plFirstName, plSurname, plEmail ";
	$sql_select .= "FROM {$db_prefix}players WHERE plPlayerID = $PLAYER_ID";
	//Run SELECT query and send e-mail
	$result = ba_db_query ($link, $sql_select);
	$row = ba_db_fetch_assoc ($result);
	$sBody = "You have been marked as paid for the upcoming event.\n";
	$sBody .= "You are now fully booked.\n\nThank you.\n\n";
	$sBody .= "Player ID: " . PID_PREFIX . sprintf ('%03s', $PLAYER_ID) . "\n";
	$sBody .= "OOC Name: " . $row ['plFirstName'] . " " . $row ['plSurname'];
	if ($bEmailPaymentReceived)
		mail ($row ['plEmail'], SYSTEM_NAME . ' - marked paid', $sBody, "From:" . SYSTEM_NAME . " <" . EVENT_CONTACT_MAIL . ">");

	//Make up URL & redirect
	$sURL = fnSystemURL () . 'start.php';
	header ("Location: $sURL");
}

if ($_POST ['btnNoPlay'] != '' && CheckReferrer ('start.php')) {
	if ($_POST ['chkNoPlay'] != '') {
		//User does not wish to play - only monster/staff. Need a row in characters table so that SQL in bookings.php will work
		//Character details - check if character exists
		$sql = "SELECT * FROM {$db_prefix}characters WHERE chPlayerID = $PLAYER_ID";
		$result = ba_db_query ($link, $sql);
		//If character does not exist insert a row so that UPDATE query will work
		if (ba_db_num_rows ($result) == 0) {
			$sql = "INSERT INTO {$db_prefix}characters (chPlayerID) VALUES ($PLAYER_ID)";
			if (! ba_db_query ($link, $sql)) {
				$sWarn = "There was a problem updating the database";
				LogError ("Error inserting player ID into characters table prior to running UPDATE query.\nPlayer ID: $PLAYER_ID");
			}
		}
		$sql = "UPDATE {$db_prefix}characters SET chMonsterOnly = 1 " .
			"WHERE chPlayerID = $PLAYER_ID";
		//Run query
		if (! ba_db_query ($link, $sql)) {
			$sWarn = "There was a problem updating the database";
			LogError ("Error updating character details. Player ID: $PLAYER_ID");
		}

		//Set bkDateICConfirmed in bookings table
		$sDate = date ('Y-m-d');
		//Check if player already has an entry in bookings table
		$sql = "SELECT * FROM {$db_prefix}bookings WHERE bkPlayerID = $PLAYER_ID";
		$result = ba_db_query ($link, $sql);
		//If player has not booked insert a new row
		if (ba_db_num_rows ($result) == 0) {
			$sql = "INSERT INTO {$db_prefix}bookings (bkPlayerID, bkDateICConfirmed) VALUES ($PLAYER_ID, '$sDate')";
			if (! ba_db_query ($link, $sql)) {
				$sWarn = "There was a problem updating the database";
				LogError ("Error inserting new monster/staff booking.\nPlayer ID: $PLAYER_ID");
			}
		}
		else {
			//Update existing row
			$sql = "UPDATE {$db_prefix}bookings SET bkDateICConfirmed = '$sDate' WHERE bkPlayerID = $PLAYER_ID";
			if (! ba_db_query ($link, $sql)) {
				$sWarn = "There was a problem updating the database";
				LogError ("Error updating new monster/staff booking.\nPlayer ID: $PLAYER_ID");
			}
		}
	}
	else
		//Check box was not ticked
		$sWarn = "You must tick the box as well as clicking the 'I do not want to play my character' button";
}

if ($_POST ['btnUnconfirmDetails'] != '' && CheckReferrer ('start.php')) {
		$sql = "DELETE FROM {$db_prefix}bookings WHERE bkPlayerID = $PLAYER_ID";
		if (! ba_db_query ($link, $sql)) {
			$sWarn = "There was a problem unconfirming your details";
			LogError ("Error removing a booking.\nPlayer ID: $PLAYER_ID");
		}
}


if ($_GET ['green'] != '')
	$sGreen .= htmlentities ($_GET ['green']);
if ($_GET ['warn'] != '')
	$sWarn .= htmlentities ($_GET ['warn']);

include ('inc/inc_head_html.php');
?>
<script type = 'text/javascript'>
<!--
function fnCheckNoChar () {
	sMsg = "Are you sure you do not want to play your own character?" + String.fromCharCode (10)
	sMsg += "If you are sure, click OK to continue" + String.fromCharCode (10)
	sMsg += "If you are not sure, click Cancel and fill in your IC details"
	return confirm (sMsg)
}
// -->
</script>
<h1><?php echo TITLE?></h1>

<h2>Next Event: <?php echo EVENT_NAME?></h2>

<?php
echo ANNOUNCEMENT_MESSAGE;
include ('inc/inc_event.php');

if ($sGreen != '')
	echo "<p class = 'green'>$sGreen</p>\n";
if ($sWarn != '')
	echo "<p class = 'warn'>$sWarn</p>\n";
//Get bookings details
$sql = "SELECT * FROM {$db_prefix}bookings WHERE bkPlayerID = $PLAYER_ID";
$result = ba_db_query ($link, $sql);
$row = ba_db_fetch_assoc ($result);
$sDateIC = $row ['bkDateICConfirmed'];
$sOOC = $row ['bkDateOOCConfirmed'];
$sDateConfirm = $row ['bkDatePaymentConfirmed'];
$bInQueue = $row['bkInQueue'];

//Check if player has entered IC & OOC data
$sql = "SELECT chName FROM {$db_prefix}characters WHERE chPlayerID = $PLAYER_ID";
$result = ba_db_query ($link, $sql);
$iIC = ba_db_num_rows ($result);

//Check for OOC data needs to check for some actual data, as a record will always exist
//Also get bunk information for later
$sql = "SELECT plFirstName, plBookAs, plBunkRequested, plBunkAssigned " .
	"FROM {$db_prefix}players " .
	"WHERE plPlayerID = $PLAYER_ID";
$result = ba_db_query ($link, $sql);
$row = ba_db_fetch_assoc ($result);
$BookAs = $row ['plBookAs'];
if ($row ['plFirstName'] != '')
	$bOOC = True;
else
	$bOOC = False;
//Get bunk & meal ticket information for later
if ((int) $row ['plBunkRequested'] == 1)
	$bBunkRequested = True;
else
	$bBunkRequested = False;
if ((int) $row ['plBunkAssigned'] == 1)
	$bBunkAssigned = True;
else
	$bBunkAssigned = False;
//Get meal ticket info
$sql = "SELECT bkMealTicket " .
	"FROM {$db_prefix}bookings " .
	"WHERE bkPlayerID = $PLAYER_ID";
$result = ba_db_query ($link, $sql);
$row = ba_db_fetch_assoc ($result);
if ((int) $row ['bkMealTicket'] != 0)
	$bMealTicket = True;
else
	$bMealTicket = False;

echo "<p>\n";
echo "In order to book this event online you must confirm your OOC and IC information and then pay, either ";
if (USE_PAY_PAL)
	echo "via PayPal or ";
echo "by cheque, cash or postal order. Once your payment has been confirmed (by an admin) you will be listed in the booking list.\n";
echo "</p>\n<p>\n";

if (($sOOC == '' || $sOOC == '0000-00-00') && $bOOC === False)
	echo "<a href = 'ooc_form.php'>Enter OOC information</a><br>\n";
elseif (($sOOC == '' || $sOOC == '0000-00-00') && $bOOC === True) {
	//$bBookingClosed is used to determine whether or not the desired booking type is closed.
	//If it is, the user gets the option to edit their OOC details to select a different booking type
	//if $bAllowOtherBooking is True
	$bBookingClosed = False;
	$bAllowOtherBooking = True;
	//Check that bookings are still available
	if ($iTotalBookings >= TOTAL_SPACES) {
		echo "<span class = 'sans-warn'>All bookings are closed</a>. You cannot book for this event.</span><br>\n";
		$bAllowOtherBooking = False;
	}
	if (($BookAs == 'Player' && $iPlayers >= PLAYER_SPACES) && ($bAllowOtherBooking == True)) {
		echo "<span class = 'sans-warn'>Character bookings are closed</a>. You cannot book as a character for this event.</span>\n";
		$bBookingClosed = True;
	}
	elseif (($BookAs == 'Monster' && $iMonsters >= MONSTER_SPACES) && ($bAllowOtherBooking == True)) {
		echo "<span class = 'sans-warn'>Monster bookings are closed</a>. You cannot book as a monster for this event.</span>\n";
		$bBookingClosed = True;
	}
	elseif (($BookAs == 'Staff' && $iStaff >= STAFF_SPACES) && ($bAllowOtherBooking == True)) {
		echo "<span class = 'sans-warn'>Staff bookings are closed</a>. You cannot book as staff for this event.</span>\n";
		$bBookingClosed = True;
	}
	else
		echo "<a href = 'ooc_view.php' class = 'sans-warn'>Confirm OOC information</a><br>\n";
	if ($bBookingClosed && $bAllowOtherBooking && ($iTotalBookings < TOTAL_SPACES))
		echo " You may <a href = 'ooc_form.php'>edit your OOC information</a> to select a different booking type\n";
}
else
	echo "<a href = 'ooc_view.php'>OOC information has been confirmed</a><br>\n";
?>
</p>

<?php
if (($sDateIC == '' || $sDateIC == '0000-00-00') && $iIC == 0)
	echo "<p><a href = 'ic_form.php'>Enter IC information</a><br>\n</p>";
elseif (($sDateIC == '' || $sDateIC == '0000-00-00') && $iIC > 0)
	echo "<p><a href = 'ic_view.php' class = 'sans-warn'>Confirm IC information</a><br>\n</p>";
else
	echo "<p><a href = 'ic_view.php'>IC information has been confirmed</a><br>\n</p>";
if (($sDateIC == '' || $sDateIC == '0000-00-00') && ($BookAs == 'Monster' || $BookAs == 'Staff')) {
	echo "<form action = 'start.php' method = 'post'>\n<p>";
	HelpLink ('help_no_ic_details.php');
	echo "&nbsp;<b>If you do not want to play your character <i>at all</i></b>, you do not have to provide IC details. " .
		"Simply tick the box below and click the 'I do not want to play my character' button.<br>\n";
	echo "<input type = 'checkbox' value = 'NoPlay' name = 'chkNoPlay'> I do not want to play my character<br>\n";
	echo "<input type = 'submit' value = 'I do not want to play my character' name = 'btnNoPlay' " .
		"onclick = 'return fnCheckNoChar ()'><br>\n</p>";
	echo "</form>\n";
}
?>

<p>
<?php
//PayPal links
if ($sOOC == '' || $sOOC == '0000-00-00' || $sDateIC == '' || $sDateIC == '0000-00-00')
	echo "You cannot pay until IC and then OOC information is confirmed.<br>\n";
elseif (USE_PAY_PAL == False)
		echo "<p><b>See the <a href = 'event.php'>event details page</a> for information on how to pay.</b></p>\n";
elseif (USE_PAY_PAL == True) {
	if ($sDateConfirm == '' || $sDateConfirm == '0000-00-00') {
		echo "<p>";
		echo "<table><tr><td>";
		echo "As you have not yet paid, you can still unconfirm your details to make changes";
		//echo "</p>";
		echo "</td><td>";
		echo "<form action = 'start.php' method = 'post'>\n";
		echo "<input type='submit' name='btnUnconfirmDetails' value = 'Unconfirm my details' />";
		echo "</form>";
		echo "</td></table>";
		echo "</p>";

		if ($bInQueue)
		{
			echo "<p>Your booking is currently in a queue, it needs to be approved by an admin before you can finalise and pay.<br/>Contact <a href = 'mailto:" .Obfuscate (EVENT_CONTACT_MAIL) . "'>" . EVENT_CONTACT_NAME . "</a> if you need further information.";
			echo "</p>";
		}
		else
		{
			echo "<p>To pay via PayPal, click on one of the buttons below. <b>See the <a href = 'event.php'>event details page</a> for other ways to pay.</b><br>\nIf a price is marked as &pound;0.00, clicking on the link will simply finalise your booking - no payment is required in this case.</p>\n";
			echo "<table><tr>\n";
			if ($BookAs == "Player") {
				paypalButton(PAYPAL_PLAYER_1, PAYPAL_AMOUNT_P1, "no", "no");
				paypalButton(PAYPAL_PLAYER_2, PAYPAL_AMOUNT_P2, "yes", "yes");
				paypalButton(PAYPAL_PLAYER_3, PAYPAL_AMOUNT_P3, "no", "yes");
				paypalButton(PAYPAL_PLAYER_4, PAYPAL_AMOUNT_P4, "yes", "no");
			}
			if ($BookAs == "Monster") {
				paypalButton(PAYPAL_MONSTER_1, PAYPAL_AMOUNT_M1, "no", "no");
				paypalButton(PAYPAL_MONSTER_2, PAYPAL_AMOUNT_M2, "yes", "yes");
				paypalButton(PAYPAL_MONSTER_3, PAYPAL_AMOUNT_M3, "no", "yes");
				paypalButton(PAYPAL_MONSTER_4, PAYPAL_AMOUNT_M4, "yes", "no");
			}
			if ($BookAs == "Staff") {
				paypalButton(PAYPAL_STAFF_1, PAYPAL_AMOUNT_S1, "no", "no");
				paypalButton(PAYPAL_STAFF_2, PAYPAL_AMOUNT_S2, "yes", "yes");
				paypalButton(PAYPAL_STAFF_3, PAYPAL_AMOUNT_S3, "no", "yes");
				paypalButton(PAYPAL_STAFF_4, PAYPAL_AMOUNT_S4, "yes", "no");
			}
			echo "</tr>\n";
			echo "<tr>\n";
			if ($BookAs == "Player") {
				if (PAYPAL_AMOUNT_P1 != '')
					echo "<td class = 'mid'>" . PAYPAL_PLAYER_1 . ", &pound;" . PAYPAL_AMOUNT_P1 . "</td>\n";
				if (PAYPAL_AMOUNT_P2 != '' && $iPlayerBunks < PLAYER_BUNKS && $iTotalBunks < TOTAL_BUNKS)
					echo "<td class = 'mid'>" . PAYPAL_PLAYER_2 . ", &pound;" . PAYPAL_AMOUNT_P2 . "</td>\n";
				if (PAYPAL_AMOUNT_P3 != '' && $iPlayerBunks < PLAYER_BUNKS && $iTotalBunks < TOTAL_BUNKS)
					echo "<td class = 'mid'>" . PAYPAL_PLAYER_3 . ", &pound;" . PAYPAL_AMOUNT_P3 . "</td>\n";
				if (PAYPAL_AMOUNT_P4 != '')
					echo "<td class = 'mid'>" . PAYPAL_PLAYER_4 . ", &pound;" . PAYPAL_AMOUNT_P4 . "</td>\n";
			}
			if ($BookAs == "Monster") {
				if (PAYPAL_AMOUNT_M1 != '')
					echo "<td class = 'mid'>" . PAYPAL_MONSTER_1 . ", &pound;" . PAYPAL_AMOUNT_M1 . "</td>\n";
				if (PAYPAL_AMOUNT_M2 != '' && $iMonsterBunks < MONSTER_BUNKS && $iTotalBunks < TOTAL_BUNKS)
					echo "<td class = 'mid'>" . PAYPAL_MONSTER_2 . ", &pound;" . PAYPAL_AMOUNT_M2 . "</td>\n";
				if (PAYPAL_AMOUNT_M3 != '' && $iMonsterBunks < MONSTER_BUNKS && $iTotalBunks < TOTAL_BUNKS)
					echo "<td class = 'mid'>" . PAYPAL_MONSTER_3 . ", &pound;" . PAYPAL_AMOUNT_M3 . "</td>\n";
				if (PAYPAL_AMOUNT_M4 != '')
					echo "<td class = 'mid'>" . PAYPAL_MONSTER_4 . ", &pound;" . PAYPAL_AMOUNT_M4 . "</td>\n";
			}
			if ($BookAs == "Staff") {
				if (PAYPAL_AMOUNT_S1 != '')
					echo "<td class = 'mid'>" . PAYPAL_STAFF_1 . ", &pound;" . PAYPAL_AMOUNT_S1 . "</td>\n";
				if (PAYPAL_AMOUNT_S2 != '' && $iStaffBunks < STAFF_BUNKS && $iTotalBunks < TOTAL_BUNKS)
					echo "<td class = 'mid'>" . PAYPAL_STAFF_2 . ", &pound;" . PAYPAL_AMOUNT_S2 . "</td>\n";
				if (PAYPAL_AMOUNT_S3 != '' && $iStaffBunks < STAFF_BUNKS && $iTotalBunks < TOTAL_BUNKS)
					echo "<td class = 'mid'>" . PAYPAL_STAFF_3 . ", &pound;" . PAYPAL_AMOUNT_S3 . "</td>\n";
				if (PAYPAL_AMOUNT_S4 != '')
					echo "<td class = 'mid'>" . PAYPAL_STAFF_4 . ", &pound;" . PAYPAL_AMOUNT_S4 . "</td>\n";
			}
			echo "</tr></table>\n";
		}
	}
	else {
		echo "<span class = 'sans-green'>Receipt of your payment has been confirmed, and you are now fully booked.";
		if ($bBunkRequested == True && $bBunkAssigned == False)
			echo "<br>\nYour request for a bunk is acknowledged, but a bunk has not yet been assigned to you.";
		if ($bBunkAssigned)
			echo "<br>\nA bunk has been assigned to you.";
		if ($bBunkRequested == False)
			echo "<br>\nYou have not requested a bunk.";
		if ($bMealTicket == False)
			$s = " not";
			echo "<br>\nYou have$s bought a meal ticket.";
		echo "</span>";
	}
}
?>
</p>

<?php
include ('inc/inc_foot.php');
?>
